<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Insert title here</title>
        <script type="text/javascript">
        	function updateselect(){
				for(var i=0;i<length;i++){
					document.myForm.mySelect.options[i].value="update value "+i;
					document.myForm.mySelect.options[i].text="update text "+i;
				}
			}
        </script>
    </head>
    <body>
    	<form action="" name="myForm">
    		<select name="mySelect" onchange="alert(this.value);">
    			<option value="1">select1</option>
				<option value="2" selected>select2</option>
    		</select>
    	</form>
		<script type="text/javascript">
			var length=document.myForm.mySelect.length;
			document.write("oldlength==="+length);
			document.myForm.mySelect.length++;
			document.myForm.mySelect.options[length].value="3";
			document.myForm.mySelect.options[length].text="select3";
			document.write("   newlength==="+document.myForm.mySelect.length);
			document.myForm.mySelect.selectedIndex=length;
			length++;
		</script>
		<br>
		<a href="#" onclick="updateselect();">update</a>
    </body>
</html>
